// 如果对象里面有函数，不要用module.exports输出, 否则前端会报错
export default {
  showLog() {},

  showErr() {},

  // 安全eval执行表达式（纯数字运算），已咨询专家，codecheck可申请屏蔽
  safeEval(code) {
    const whiteList = '0123456789+-*/%()><=!.&| ';
    const codeArr = Array.from(code);
    const filteredCodeArr = codeArr.filter(character => whiteList.includes(character));
    const filteredCode = filteredCodeArr.join('');

    let res = false;
    try {
      res = eval(filteredCode);
    } catch (e) {}
    return res;
  },

};
